<c:forEach>取list里bean的值

来源:百度知道 编辑:UC知道 时间:2024/06/15 13:14:28
while(rs.next()){
boption.setOptions_id(rs.getInt(1)) ;
boption.setOtionsname(rs.getString(2));
boption.setOptionsnumber(rs.getInt(3));
boption.setPtionsexplain(rs.getString(4));
listboption.add(boption);
}
request.setAttribute("list",listboption);
然后页面怎么取值就正不明白了

C:forEach这个取值还挺好用的,我一般就用它
<c:forEach var="boption" items="${list}">//var的值随便起,起啥下面就用啥
${boption.options_id}
${boption.optionsname}
${boption.optionsnumber}
${boption.optionssexplain}
</c:forEach>

<c:forEach var="boption" items="${ist}" >
${boption.Otionsname}
</c:forEach>

高手们都说完了。
我现在的问题是
aaaBean中放了一个list list中放了一个 bbbBean

c:forEach var="boption" items="${aaaBean.ist}" >
${boption.XXXX}
</c:forEach>
为什麽取不出来?

不对,你查询是吧?

while(rs.next()){

xx boption=new xx();

boption.setOptions_id(rs.getInt(1)) ;
boption.setOtionsname(rs.getString(2));
boption.setOptionsnumber(rs.getInt(3));
boption.setPtionsexplain(rs.getString(4));
listboption.add(boption);

return listboption;//不知道你用什么标记这个listboption供页面取出,我就认为是list 吧
}